﻿import { Component } from '@tarojs/taro'
import { View, Text,Image} from '@tarojs/components'
import {AtTag} from 'taro-ui'
import './myyouhuiquan.css'
import yq from '../../img/youhuiquan3.png'
import by from '../../img/banyuan.png'
import right from '../../img/right.png'
import { bindCallback } from 'when/node';
import app from '../../main';

export default class youhuiquan extends Component {

  config = {
    navigationBarTitleText: '爱眼医生'
  }
  constructor () {
    super(...arguments)
    this.state = {

    }
    this.props={
        texinfo:{
            // discount:"discount",
            // full_money:"full_money",
            // title:"title",
            // scope:"scope",
            // end_time:"end_time",
            // use_type:"use_type",
            // coupon_type:"coupon_type"
        },
        onXiangqing:()=>{}
    }
  }
  gotoFindDoc(){
    app.navigateTo('../findDoctor/findDoctor')
  }

  render () {

    return (
        <View className="myCoopn">          
            <View className="card">
                <Image className='card-by' src={by}/>
                <View className="card-info">
                {this.props.textinfo.coupon_type == "满减"
                ?   <Text className='card-info1'>￥{parseFloat(this.props.textinfo.discount.toString())}</Text>
                :   <Text className='card-info1'>{this.props.textinfo.discount}折</Text>
                }
                <Text className='card-info2'>满{parseFloat(this.props.textinfo.full_money.toString())}元可用</Text>
                </View>
                <Image className='card-yq' src={yq}/>
            </View>
            <View className='card-content'>
                <View className="card-content-title">
                   <Text>{this.props.textinfo.title}</Text> 
                </View>
                <View className='card-content-row'>
                    <View className='card-content-text'>
                        <Text>适用项目:{this.props.textinfo.scope}</Text>
                        {
                            this.props.textinfo.use_type =='领券后多少天可用'
                            ?   <Text>有效期至:领后{this.props.textinfo.days}天可用</Text>
                            :   <Text>有效期至:  {this.props.textinfo.end_time}</Text>
                        }
                        {/* <Text>有效期至:  {this.props.textinfo.end_time}</Text> */}
                    </View>
                    <View className='text-and-tag'>
                        <AtTag className='card-content-tag' circle size='normal' onClick={this.gotoFindDoc}>
                        <Text className='nowplay'>立即使用</Text>
                        </AtTag>
                    </View>      
                </View>
                <View onClick={this.props.onXiangqing.bind(this)} className='many'>详细说明 <Image style='height:10px;width:10px;' src={right}/></View>

            </View>
 
        </View> 
    )
  }
}